﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using Ngram;
using NgramServer;

namespace ConsoleHost
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Enter data path:");
            string path = Console.ReadLine();
            Console.WriteLine("Reading data...");
            Ngram.Data.readData(path);
            Data.AllowFilter = true;
            Data.ThresholdFilter = 10;
            Data.ThresholdNotFound = 0.0000001;
            Console.WriteLine("Complete");
            ServiceHost host = new ServiceHost(typeof(NgramService));
            Console.WriteLine("Ngram Service Host starting...");
            host.Open();
            Console.WriteLine("Service Started!");
            foreach (Uri address in host.BaseAddresses)
            {
                Console.WriteLine("Listening on " + address);
            }
            Console.WriteLine("Press any key to close the host...");
            Console.ReadLine();
            host.Close();
        }
    }
}
